package xyz.ljcc.ccmt.repository.admin;

import java.util.List;

import org.springframework.data.jpa.repository.Query;

import xyz.ljcc.ccmt.commons.repository.base.BaseRepository;
import xyz.ljcc.ccmt.model.base.Dept;

public interface DeptRepository extends BaseRepository<Dept, Integer> {
	/**
	 * 根据用户ID返回对应的科室权限信息
	 * @param userId
	 * @return
	 */
	@Query("select d from Dept d,UserVsDept ud "
			+ " where d.deptCode = ud.deptCode and ud.loginName = ?1 order by d.deptCode")
	List<Dept> loadByLoginName(String loginName);
	
	/**
	 * 根据科室名称模糊搜索科室列表
	 * @param deptName
	 * @return
	 */
	List<Dept> getByDeptNameContaining(String deptName);
}
